package ee.ut.aa.neuraltic.neural;

public class Synaps {

	private Neuron neuron;
	private double weight;

	public Synaps( Neuron neuron ) {

		// Should be between -1..1
		this.weight = Math.random() * 2 - 1;
		this.neuron = neuron;
	}

	public Neuron getNeuron() {
		return neuron;
	}

	public void setNeuron( Neuron neuron ) {
		this.neuron = neuron;
	}

	public double getWeight() {
		return weight;
	}

	public void setWeight( double weight ) {
		this.weight = weight;
	}

	@Override
	public String toString() {

		String rounded = String.format( "%.5f", weight );

		// Negative value alignment
		return weight < 0 ? rounded : " " + rounded;
	}
}
